﻿Imports DTO
Imports DAO
Public Class SoTietKiemBUS
    Public Function ThemSoTietKiem(ByVal stkDTO As SoTietKiemDTO) As Integer
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.ThemSoTietKiem(stkDTO)
    End Function
    'Lây tất cả sổ tiết kiệm
    Public Function LaySoTietKiem() As List(Of SoTietKiemDTO)
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.LaySoTietKiem()
    End Function
    ' Lấy sổ tiết kiệm không kỳ hạn
    Public Function LaySoTietKiemDuocGoiTien() As List(Of SoTietKiemDTO)
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.LaySoTietKiemDuocGoiTien()
    End Function
    'Lay so du tai khoan
    Public Function LaySoDuTaiKhoan(ByVal maso As Integer) As Double
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.LaySoDuTaiKhoan(maso)
    End Function
    'update số dư tai khoang sau khi goi
    Public Function SoDuTaiKhoanSauKhiGoi(ByVal maso As Integer, ByVal sotiengoi As Double) As Integer
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.CapNhatSoDuTaiKhoanSauKhiGoi(maso, sotiengoi)
    End Function
    'update số dư tai khoang sau khi rút
    Public Function SoDuTaiKhoanSauKhiRut(ByVal maso As Integer, ByVal sotienrut As Double) As Integer
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.CapNhatSoDuTaiKhoanSauKhiRut(maso, sotienrut)
    End Function
    'Tim kiếm sổ tiết kiệm theo mã sổ
    Public Function TimKiemTheoMaSo(ByVal maso As Integer) As SoTietKiemDTO
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.TimkiemTheoMaSo(maso)
    End Function
    Public Shared Function TraCuuSo(ByVal sTietKiemCrt As SoTietKiemCrt) As DataTable
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.TraCuuSo(sTietKiemCrt)
    End Function
    'Tim kiem theo nhieu tieu chi
    Public Function TimKiem(ByVal stkCrt As SoTietKiemCrt) As DataTable
        Dim dsstk As New DataTable()
        Dim svDAO As New SoTietKiemDAO()
        dsstk = svDAO.TimKiem(stkCrt)
        Return dsstk
    End Function
    'Lấy mã tiết kiệm max
    Public Function LayMaSoTietKiemMax() As Integer
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.LayMaTietKiemMax()
    End Function

    Public Function LayThongTinSoTietKiem(ByVal maso As String) As DataTable
        Dim dt As New DataTable()
        Dim stkDAO As New SoTietKiemDAO()
        dt = stkDAO.LayThongTinSoTietKiem(maso)
        Return dt
    End Function
    'Ham cap nhat so tiet kiem
    Public Function CapNhatSoTietKiem(ByVal stkDTO As SoTietKiemDTO) As Integer
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.CapNhatSoTietKiem(stkDTO)
    End Function

    Public Function LayThongTinDanhSachSoTietKiem() As DataTable
        Dim stkDao As New SoTietKiemDAO()
        Dim dt As New DataTable()
        dt = stkDao.LayThongTinDanhSachSoTietKiem()
        Return dt
    End Function

    Public Function ImportTuExcel(ByVal str As String) As DataTable
        Dim stkDao As New SoTietKiemDAO()
        Return stkDao.ImportTuExcel(str)
    End Function

    Public Function TongThu(ByVal _date As Date)

        Dim ltkDao As New SoTietKiemDAO()
        Return ltkDao.TongThu(_date)

    End Function
    ' 'Hàm cập nhật lại mã tình trạng sổ tiết kiệm
    Public Function CapNhaMTTSTK(ByVal matt As Integer, ByVal ngayDong As Date, ByVal maso As Integer) As Integer
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.CapNhaMTTSTK(matt, ngayDong, maso)
    End Function

    ' Báo cáo sổ mở đóng hàng tháng
    Public Function SoMoDong(ByVal ngay As Date, ByVal maltk As Integer) As DataTable
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.SoMoDong(ngay, maltk)
    End Function

    Public Function Xoa(ByVal maso As Integer) As Integer
        Dim stkDAO As New SoTietKiemDAO()
        Return stkDAO.Xoa(maso)
    End Function
End Class
